package in.bibek.dao;

import in.bibek.hibernate.bean.UserProfile;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

public class UserDao 
{
  private SessionFactory sessionFactory ;
  
  public UserDao(SessionFactory sessionFactory){
	  this.sessionFactory =  sessionFactory;
  }
	
  public List<UserProfile> getAllForumUsers()
  {
	  Query query = null;
	  query = getCurrentSession().createQuery(" from UserProfile");
	  List tmp = query.list();
	  getCurrentSession().close();
	  return tmp;
  }
  
  
  protected Session getCurrentSession() {
		return sessionFactory.openSession();
	}
}
